package com.xbongbong.paas.field;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.io.Serializable;

/**
 * @author: wufeng
 * @date: 2018/12/24 16:29
 * @desrcption: 过滤条件
 */
@Setter
@Getter
@ToString
public class FilterConditionsPoJo implements Serializable {
    private static final long serialVersionUID = 518595918177705990L;

    /**
     * 目标表单字段
     */
    @NotEmpty(message = "目标表单字段不能为空")
    private String attr;

    /**
     * 字段类型
     * @see com.xbongbong.paas.enums.FieldTypeEnum
     */
    @NotNull(message = "字段类型不能为空")
    private Integer fieldType;

    private String attrName;

    /**
     * 操作标示，比如等于，不等于，大于，小于等等
     * @see com.xbongbong.paas.enums.ConditionEnum
     */
    @NotEmpty(message = "操作标示不能为空")
    private String symbol;

    /**
     * 值类型，1表示动态值，2表示固定值
     * @see com.xbongbong.pro.enums.businessrule.enums.RuleValueTypeEnum
     */
    @NotNull(message = "值类型不能为空")
    private Integer valueType;

    /**
     * 固定值类型的值
     */
    private Object value;

    /**
     * 本表单对应的字段，即动态值对应的字段
     */
    private String valueAttr;
    /**
     * 本表单对应的字段类型，即动态值对应的字段类型
     */
    private Integer valueFieldType;

    /**
     * 动态值-当前表单对应的字段名称
     */
    private String valueAttrName;

    /**
     * 并且：and 或者：or
     * @see com.xbongbong.pro.enums.RelTypeEnum
     */
    @NotEmpty(message = "搜索条件不能为空")
    private String rel;

    public FilterConditionsPoJo() {
    }

    public FilterConditionsPoJo(@NotEmpty(message = "目标表单字段不能为空") String attr, @NotNull(message = "字段类型不能为空") Integer fieldType, String attrName,
                                @NotEmpty(message = "操作标示不能为空") String symbol, @NotNull(message = "值类型不能为空") Integer valueType,
                                Object value, String valueAttr, Integer valueFieldType, String valueAttrName, @NotEmpty(message = "搜索条件不能为空") String rel) {
        this.attr = attr;
        this.fieldType = fieldType;
        this.attrName = attrName;
        this.symbol = symbol;
        this.valueType = valueType;
        this.value = value;
        this.valueAttr = valueAttr;
        this.valueFieldType = valueFieldType;
        this.valueAttrName = valueAttrName;
        this.rel = rel;
    }
}
